<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     pagizer
 * @subpackage  backoffice
 */

function smarty_function_selectDoc($params, &$smarty)
{ 
    $lang = f_context_Block::getInstance()->getParameter('blockLang');
    $model = $params['model'];
    $inputId = $params['id'];

    $url = URL_RELATIVE.'/bo/?module=backoffice&action=AjaxSearchDoc&model='.$model.'&lang='.$lang;

    echo '<input type="text" id="auto_'.$inputId.'" name="form['.$inputId.']" class="medium" ></input>';
    echo '<script type="text/javascript">';
    echo '  $("#auto_'.$inputId.'").autocomplete("'.$url.'")';
    echo '</script>';
}